// user模块
const state = {
    userInfo: {
        name: 'lh',
        age: 20
    }
}

const mutations = {
    changeUserName (state, name) {
        state.userInfo.name = name
    }
}

const actions = {
    changeUserNameAsync(context, name) {
        setTimeout(() => {
            context.commit('changeUserName', name)
        }, 1000)
    }
}

const getters = {
    UpperCaseName(state) {
        return state.userInfo.name.toUpperCase()
    }
}

export default {
    // 开启命名空间
    namespaced: true,
    state,
    mutations,
    actions,
    getters
}